﻿Imports Co9320.NicoLiveService

Class ConsoleWindow


    Private Sub MessageTextBox_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Input.KeyEventArgs)
        If e.Key <> Key.Enter Then
            Exit Sub
        End If

        Static no As Integer = 1

        Dim context = DirectCast(Me.DataContext, ViewModel.MainViewModel)
        Dim comment = New Comment() With { _
            .No = no, _
            .Premium = CInt(Me.PremiumTextBox.Text), _
            .UserId = Me.IdTextBox.Text, _
            .Text = Me.MessageTextBox.Text}

        context.InjectComment(comment)
        no += 1

        MessageTextBox.Clear()
    End Sub

End Class
